<?php /*a:1:{s:61:"D:\web\www\tp5.1\public/../app/admin\view\partition\edit.html";i:1525765028;}*/ ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title>
            编辑区服
        </title>
        <meta name="renderer" content="webkit"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
        <link rel="stylesheet" href="/static/frame/layui/css/layui.css"/>
        <link rel="stylesheet" href="/static/frame/static/css/style.css"/>
        <link rel="icon" href="/static/frame/static/image/code.png"/>
        <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
        <style type="text/css">
        .dbshow{background: #fff;overflow:hidden;border:0;}
        .dbshow .layui-colla-item{overflow:hidden;}
        .dbshow .layui-colla-title{background:#fff;text-align: center;}
        .dbshow .layui-colla-title .layui-colla-icon{left:auto;}
        .dbshow .layui-colla-content{border:0;}
            </style>
    </head>
    <body class="body">
        <form class="layui-form" action="" method="post" id="editform">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    分区名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="分区名称" class="layui-input" value="<?php echo htmlentities($info['name']); ?>"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    平台
                </label>
                <div class="layui-input-inline">
                    <select name="platform_id" lay-verify="required" lay-search="">
                        <option value="0">
                            选择平台
                        </option>
                        <?php foreach($platform as $key=>$vo): ?>
                        <option value="<?php echo htmlentities($vo['id']); ?>" <?php echo $info['platform_id']==$vo['id'] ? "selected"  :  ""; ?>><?php echo htmlentities($vo['name']); ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    区服编号
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="num" placeholder="区服编号" class="layui-input" value="<?php echo htmlentities($info['num']); ?>"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    区服地址
                </label>
                <div class="layui-input-block">
                    <input type="text" name="http" placeholder="区服地址" class="layui-input" value="<?php echo htmlentities($info['http']); ?>"/>
                </div>
            </div>
            <div class="layui-row" id="dbshow">
                <div class="layui-collapse dbshow" lay-accordion="">
                    <div class="layui-colla-item">
                        <h2 class="layui-colla-title">
                            数据配制
                        </h2>
                        <div class="layui-colla-content">
                            <div class="layui-row" <p>
                                数据库信息默认为平台配制信息，如果没有请留空
                            </p>
                        </div>
                        <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    游戏数据库主机
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="gamehost" placeholder="游戏数据库主机" class="layui-input" value="<?php echo !empty($gamedb) ? htmlentities($gamedb['host']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    游戏数据库端口
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="gameport" placeholder="游戏数据库端口" class="layui-input" value="<?php echo !empty($gamedb) ? htmlentities($gamedb['port']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    游戏数据库用户
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="gameuser" placeholder="游戏数据库用户" class="layui-input" value="<?php echo !empty($gamedb) ? htmlentities($gamedb['user']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    游戏数据库密码
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="gamepass" placeholder="游戏数据库密码" class="layui-input" value="<?php echo !empty($gamedb) ? htmlentities($gamedb['pass']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    游戏数据库名称
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="gamename" placeholder="游戏数据库名称" class="layui-input" value="<?php echo !empty($gamedb) ? htmlentities($gamedb['name']) :  ''; ?>"/>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    用户数据库主机
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="userhost" placeholder="用户数据库主机" class="layui-input" value="<?php echo !empty($userdb) ? htmlentities($userdb['host']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    用户数据库端口
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="userport" placeholder="用户数据库端口" class="layui-input" value="<?php echo !empty($userdb) ? htmlentities($userdb['port']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    用户数据库用户
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="useruser" placeholder="用户数据库用户" class="layui-input" value="<?php echo !empty($userdb) ? htmlentities($userdb['user']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    用户数据库密码
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="userpass" placeholder="用户数据库密码" class="layui-input" value="<?php echo !empty($userdb) ? htmlentities($userdb['pass']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    用户数据库名称
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="username" placeholder="用户数据库名称" class="layui-input" value="<?php echo !empty($userdb) ? htmlentities($userdb['name']) :  ''; ?>"/>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    日志数据库主机
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="loghost" placeholder="数据库主机" class="layui-input" value="<?php echo !empty($logdb) ? htmlentities($logdb['host']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    数据库端口
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="logport" placeholder="数据库端口" class="layui-input" value="<?php echo !empty($logdb) ? htmlentities($logdb['port']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    数据库用户
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="loguser" placeholder="数据库用户" class="layui-input" value="<?php echo !empty($logdb) ? htmlentities($logdb['user']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    数据库密码
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="logpass" placeholder="数据库密码" class="layui-input" value="<?php echo !empty($logdb) ? htmlentities($logdb['pass']) :  ''; ?>"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    数据库名称
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="logname" placeholder="数据库名称" class="layui-input" value="<?php echo !empty($logdb) ? htmlentities($logdb['name']) :  ''; ?>"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">
                    状态
                </label>
                <div class="layui-input-inline">
                    <input type="radio" name="status" value="1" title="正常" <?php echo !empty($info['status']) ? "checked=''"  :  ""; ?>/>
                    <input type="radio" name="status" value="0" title="禁止" <?php echo !empty($info['status']) ? ""  :  "checked=''"; ?>/>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1">
                    立即提交
                </button>
                <button type="reset" class="layui-btn layui-btn-primary">
                    重置
                </button>
            </div>
        </div>
        <?php if(!(empty($info) || (($info instanceof \think\Collection || $info instanceof \think\Paginator ) && $info->isEmpty()))): ?>
        <input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>"/>
        <?php endif; ?>
    </form>
    <script src="/static/frame/layui/layui.js" charset="utf-8"></script>
    <script src="/static/admin/js/comm.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'upload', 'laydate', 'layedit', 'admin'], function() {
          var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            layedit = layui.layedit,
            laydate = layui.laydate,
            admin = layui.admin;
    
    
          //自定义验证规则
          form.verify({
            title: function(value) {
              if (value.length < 2) {
                return '标题至少得2个字符啊';
              }
            }
          });
    
          laydate.render({
            elem: '#date1'
          });
    
          layedit.set({
            uploadImage: {
              url: '<?php echo url('admin/Webconfig/upload'); ?>' //接口url
              ,
              type: 'post' //默认post
            }
          });
          //创建一个编辑器
          var editIndex = layedit.build('LAY_demo_editor');
          //设定文件大小限制
          upload.render({
            elem: '#test7',
            url: '<?php echo url('admin/Webconfig/upload'); ?>',
            size: 500 //限制文件大小，单位 KB
              ,
            done: function(res) {
              if (res.code == 0) {
                $('#typeimg').val(res.data.src);
              } else {
                layer.alert(res.msg, {
                  title: '上传失败'
                });
              }
              //console.log(res.path)
            }
          });
          form.on('submit(demo1)', function(data) {
            $.post('<?php echo url('admin/Partition/edit'); ?>', $('#editform').serialize(),
              function(data) {
                if (data.code == 1) {
                  layer.alert(data.msg, {
                    skin: 'layui-layer-molv' //样式类名
                      ,
                    closeBtn: 0
                  }, function() {
                    location.href = data.url;
                  });
                } else {
                  layer.msg(data.msg);
                }
              });
            return false;
          });
    
        });
    </script>
</body>
</html>
